package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.DmcDeviceLogMapper;
import com.csun.cmny.provider.model.domain.DmcDeviceLog;
import com.csun.cmny.provider.model.dto.log.DeviceLogQueryDto;
import com.csun.cmny.provider.service.DmcDeviceLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-07-16 16:48
 * @Description: the class dmc device log service impl
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class DmcDeviceLogServiceImpl extends BaseService<DmcDeviceLog>
        implements DmcDeviceLogService {

    @Resource
    private DmcDeviceLogMapper dmcDeviceLogMapper;

    /**
     * 查询设备日志列表 - 分页查询
     *
     * @param deviceLogQueryDto
     * @return
     */
    @Override
    public PageInfo queryDeviceLogListWithPage(DeviceLogQueryDto deviceLogQueryDto) {

        PageHelper.startPage(deviceLogQueryDto.getPageNum(), deviceLogQueryDto.getPageSize());

        List<DmcDeviceLog> dmcDeviceLogList = dmcDeviceLogMapper.queryDeviceLogListWithPage(deviceLogQueryDto);

        return new PageInfo<>(dmcDeviceLogList);
    }
}
